/*
 * Copyright (c) 2017. Visionet and/or its affiliates. All right reserved.
 * VISIONET PROPRIETARY/CONFIDENTIAL.
 */
package com.visionet.security.domain.entity;

import com.visionet.jumper.core.domain.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 资源权限
 * @author TC.Ubuntu
 * @since 2017/7/11.
 */
@Entity(name="Privilege")
@Table(name="t_privilege")
@DynamicInsert
@DynamicUpdate
public class Privilege extends BaseEntity {

	private static final long serialVersionUID = 8437724596956441147L;

	private String name;

	private String description;

	/**
	 * 权限对应资源
	 */
	@ManyToOne(fetch = FetchType.EAGER)
	private Resource resource;

	/**
	 *  权限操作。以逗号分隔，与资源类型拼接成实际权限
	 */
	private String operations;

	/**
	 * @return the resource
	 */
	public Resource getResource() {
		return resource;
	}

	/**
	 * @param resource
	 *            the resource to set
	 */
	public void setResource(Resource resource) {
		this.resource = resource;
	}

	/**
	 * @return the operation
	 */
	public String getOperations() {
		return operations;
	}

	/**
	 * @param operations
	 *            the operation to set
	 */
	public void setOperations(String operations) {
		this.operations = operations;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

}
